package com.zzy.app.config;

import com.zzy.app.entity.Person;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

/**
 * 在IOCTest test3中研究自定义bean scope,实现线程内singleton对象实例
 */
@Configuration
public class MainConfig3 {

    @Scope("thread")
    @Bean
    public Person person() {
        System.out.println("此时实例化了person bean！");
        return new Person("zzy", 18);
    }
}
